﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using aData = Portal.Core.Data.Customer.aData;

namespace Portal.Core.Customer
{
    public class bVideo
    {
        public static string Description;
        public static string Thumbnail;
        public static string Trailer_link;
        public static string Direct;
        public static string Id_Actor;
        public static string Actor;
        public static string Category;
        public static string Produce;
        public static string Nationals;
        public static int part_sum;
        public static int id_privacy_level;
        public static int view_count;
        public static int is_blocked;
        public static string produce_year;
        public static string TitleVN;
        public static string TitleEN;
        public static void GetDetailVideoForID(int Id_Video)
        {
            DataTable tb = aData.GetDetailVideoForID(Id_Video).Tables[0];
            if (tb.Rows.Count > 0)
            {
                TitleVN = tb.Rows[0]["Title_VI"].ToString();
                TitleEN = tb.Rows[0]["Title_EN"].ToString();
                Description = tb.Rows[0]["Description"].ToString();
                Thumbnail = tb.Rows[0]["Thumbnail"].ToString();
                Trailer_link = tb.Rows[0]["Trailer_link"].ToString();
                Direct = tb.Rows[0]["Direct"].ToString();
                Direct = Direct.Substring(0, Direct.Length - 1);
                Id_Actor = tb.Rows[0]["Id_Actor"].ToString();
                Actor = tb.Rows[0]["Actor"].ToString();
                Category = tb.Rows[0]["Category"].ToString();
                Produce = tb.Rows[0]["Produce"].ToString();
                Nationals = tb.Rows[0]["Nationals"].ToString();
                part_sum = int.Parse(tb.Rows[0]["part_sum"].ToString());
                id_privacy_level = int.Parse(tb.Rows[0]["id_privacy_level"].ToString());
                view_count = int.Parse(tb.Rows[0]["view_count"].ToString());
                is_blocked = int.Parse(tb.Rows[0]["is_blocked"].ToString());
                produce_year = tb.Rows[0]["produce_year"].ToString();

            }
        }
        
        public static string[] ListSourceLink;
        public static string[] ListIDPartLink;
        public static void GetSourceLinkForID(int Id_Video)
        {
            DataTable tb = aData.GetSourceLinkVideoForID(Id_Video).Tables[0];
            ListSourceLink = new string[tb.Rows.Count];
            ListIDPartLink = new string[tb.Rows.Count];
            if (tb.Rows.Count > 0)
            {
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    ListIDPartLink[i] = tb.Rows[i]["id_part"].ToString();
                    ListSourceLink[i] = tb.Rows[i]["source_link"].ToString();
                }
            }
        }
    }
}
